home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 191 < prev    next >
Encoding:
Text File  |  1996-08-06  |  3.3 KB  |  110 lines

  1. Newsgroups: comp.std.c
  2. Path: uu4news.netcom.com!lavc!lavc!mlf
  3. From: mlf@support.com
  4. Subject: HOW TO CALCULATE THE
  5. Message-ID: <9601260108.01LNF04@support.com>
  6. References: <4e88us$o82@scotsman.ed.ac.uk>
  7. Organization: L.A. Valley College Public BBS (818)985-7150
  8. X-Mailer: TBBS/PIMP v3.35
  9. Distribution: world
  10. Date: Fri, 26 Jan 96 01:08:23 -0800
  11.  
  12.  
  13. -=> News wrote on 01-25-96  15:56 the following:
  14.  
  15.  Ne> Newsgroups: comp.std.c
  16.  Ne> From: juggler@iquest.net (Phil Paxton)
  17.  Ne> Subject: Re: How to calculate the Holy Easter.
  18.  Ne> Organization: IQuest Internet, Inc.
  19.  Ne> Date: Thu, 25 Jan 1996 02:19:33 GMT
  20.  
  21.  Ne> chierici@cs.unibo.it (Andrea Chierici) writes:
  22.  
  23.  >Hi, can anybody send me a C function to calculate the Easter of every year?
  24.  >Thanks in advance,
  25.  >                        Andrea.
  26.  
  27.  Ne> This was floating about the 'net:
  28.  
  29.  Ne> Path:
  30.  Ne> dorite!news.sprintlink.net!gatech!news.mathworks.com!news.kei.com!simte
  31.  Ne> l!zippo. uwasa.fi!poiju.uwasa.fi!not-for-mail
  32.  Ne> From: A.Timmerman@beta.hsholland.nl (Abe Timmerman)
  33.  Ne> Newsgroups: comp.lang.pascal
  34.  Ne> Subject: Easter-date
  35.  Ne> Date: 24 May 1995 12:29:11 -0000
  36.  Ne> Organization: Hogeschool Holland Sector Beta
  37.  Ne> Lines: 47
  38.  Ne> Sender: ts@poiju.uwasa.fi
  39.  Ne> Approved: news@poiju.uwasa.fi
  40.  Ne> Message-ID: <ts9505241228.4174@poiju.uwasa.fi>
  41.  Ne> NNTP-Posting-Host: poiju.uwasa.fi
  42.  Ne> Summary: Reposted by Timo Salmi
  43.  
  44.  Ne> I saw the message about the easter-date program and knew I had an
  45.  Ne> algorithm somewhere.
  46.  
  47.  Ne> This is the algorithm Gauss published in 1800 to calculate
  48.  Ne> Easter-date. The notes in my textbook stated that the earliest date for
  49.  Ne> Easter is March 22, and
  50.  Ne> the latest date is April 25.
  51.  
  52.  Ne> Here's a pascal procedure for the Gauss-Easter algorithm:
  53.  Ne> ------------------------------------------------------------
  54.  Ne> procedure Easter(var Month, Day: Integer; Year: Integer);
  55.  Ne> { Based on the formulas/algorithm published bij Gauss in 1800 }
  56.  Ne> var a, b, c, d, e, f, k, m, n, p, q: Integer;
  57.  Ne> begin
  58.  Ne> a := Year mod 19;
  59.  Ne> b := Year mod 4;
  60.  Ne> c := Year mod 7;
  61.  Ne> k := Year div 100;
  62.  Ne> p := k div 3;
  63.  Ne> q := k - k div 4;
  64.  Ne> m := (q - p + 15) mod 30;
  65.  Ne> n := (q + 4) mod 7;
  66.  Ne> d := (19*a + m) mod 30;
  67.  Ne> e := (2*b + 4*c + 6*d + n) mod 7;
  68.  Ne> f := d + e - 9;
  69.  Ne> if f <= 0 then
  70.  Ne> begin
  71.  Ne> Month := 3;
  72.  Ne> Day := 31 + f;
  73.  Ne> end
  74.  Ne> else
  75.  Ne> begin
  76.  Ne> Month := 4;
  77.  Ne> if f = 26 then Day := 19
  78.  Ne> else if (f = 25) and (d = 28) then Day := 18
  79.  Ne> else Day := f;
  80.  Ne> end;{ else }
  81.  Ne> end;{ Easter }
  82.  
  83.  Ne> Greetings,
  84.  
  85.  Ne> Abe Timmerman
  86.  Ne> Hogeschool Holland
  87.  Ne> (HHIT: Center for education and Information Technology)
  88.  Ne> The Netherlands
  89.  Ne> Email:A.Timmerman@Beta.hsholland.nl
  90.  
  91.  Ne> (And remeber...)
  92.  
  93.  
  94.  Ne> --
  95.  Ne> ------------------------------------
  96.  Ne> Phil Paxton :: Fishers, Indiana, USA
  97.  
  98.  
  99. Er, ah, could somebody translate this to C???
  100.  
  101.  ----------------------------------------------------------
  102. +     Mike Flower     +         Software Designer          +
  103. + 10227 Langmuir Ave. + >>>>>> Available for hire <<<<<<   +
  104. + Sunland, CA  91040  + Call now for an interview, Today!  +
  105. +         USA         +           mlf@support.com          +
  106. +     818-353-8394    +        mlf@support.la.ca.us        +
  107.  ----------------------------------------------------------
  108.  
  109. ___ Blue Wave/QWK v2.12
  110.